package com.gigalaxy.game.protocol {
	import com.netease.protobuf.*;
	import com.netease.protobuf.fieldDescriptors.*;
	import flash.utils.Endian;
	import flash.utils.IDataInput;
	import flash.utils.IDataOutput;
	import flash.utils.IExternalizable;
	import flash.errors.IOError;
	import com.gigalaxy.game.protocol.CardsData.EncryptorTypeData;
	import flash.utils.ByteArray;
	// @@protoc_insertion_point(imports)

	// @@protoc_insertion_point(class_metadata)
	public dynamic final class CardsData extends com.netease.protobuf.Message {
		public static const ENCRYPTORDATA:FieldDescriptor$TYPE_ENUM = new FieldDescriptor$TYPE_ENUM("com.gigalaxy.game.protocol.CardsData.encryptorData", "encryptorData", (1 << 3) | com.netease.protobuf.WireType.VARINT, com.gigalaxy.game.protocol.CardsData.EncryptorTypeData);

		private var encryptorData$field:int;

		private var hasField$0:uint = 0;

		public function clearEncryptorData():void {
			hasField$0 &= 0xfffffffe;
			encryptorData$field = new int();
		}

		public function get hasEncryptorData():Boolean {
			return (hasField$0 & 0x1) != 0;
		}

		public function set encryptorData(value:int):void {
			hasField$0 |= 0x1;
			encryptorData$field = value;
		}

		public function get encryptorData():int {
			return encryptorData$field;
		}

		public static const CARDSBYTES:FieldDescriptor$TYPE_BYTES = new FieldDescriptor$TYPE_BYTES("com.gigalaxy.game.protocol.CardsData.cardsBytes", "cardsBytes", (2 << 3) | com.netease.protobuf.WireType.LENGTH_DELIMITED);

		private var cardsBytes$field:flash.utils.ByteArray;

		public function clearCardsBytes():void {
			cardsBytes$field = null;
		}

		public function get hasCardsBytes():Boolean {
			return cardsBytes$field != null;
		}

		public function set cardsBytes(value:flash.utils.ByteArray):void {
			cardsBytes$field = value;
		}

		public function get cardsBytes():flash.utils.ByteArray {
			return cardsBytes$field;
		}

		/**
		 *  @private
		 */
		override public final function writeToBuffer(output:com.netease.protobuf.WritingBuffer):void {
			if (hasEncryptorData) {
				com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 1);
				com.netease.protobuf.WriteUtils.write$TYPE_ENUM(output, encryptorData$field);
			}
			if (hasCardsBytes) {
				com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.LENGTH_DELIMITED, 2);
				com.netease.protobuf.WriteUtils.write$TYPE_BYTES(output, cardsBytes$field);
			}
			for (var fieldKey:* in this) {
				super.writeUnknown(output, fieldKey);
			}
		}

		/**
		 *  @private
		 */
		override public final function readFromSlice(input:flash.utils.IDataInput, bytesAfterSlice:uint):void {
			var encryptorData$count:uint = 0;
			var cardsBytes$count:uint = 0;
			while (input.bytesAvailable > bytesAfterSlice) {
				var tag:uint = com.netease.protobuf.ReadUtils.read$TYPE_UINT32(input);
				switch (tag >> 3) {
				case 1:
					if (encryptorData$count != 0) {
						throw new flash.errors.IOError('Bad data format: CardsData.encryptorData cannot be set twice.');
					}
					++encryptorData$count;
					this.encryptorData = com.netease.protobuf.ReadUtils.read$TYPE_ENUM(input);
					break;
				case 2:
					if (cardsBytes$count != 0) {
						throw new flash.errors.IOError('Bad data format: CardsData.cardsBytes cannot be set twice.');
					}
					++cardsBytes$count;
					this.cardsBytes = com.netease.protobuf.ReadUtils.read$TYPE_BYTES(input);
					break;
				default:
					super.readUnknown(input, tag);
					break;
				}
			}
		}

	}
}
